<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="templates/template.xhtml">
	<f:metadata>
		<f:event listener="#{irBean.load}" type="preRenderView" />
	</f:metadata>
	<ui:define name="context">
		<ui:include src="contextmenu.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<p:panel header="Proceso de agrupamiento difuso"
				styleClass="align_top">
				<p:panelGrid columns="6">
					<p:panelGrid columns="1" style="width: 200px; height:150px">
						<f:facet name="header"> Indice Invertido</f:facet>
						<p:panelGrid columns="2">
							<p:outputLabel>Cantidad Minima de Ocurrencias:</p:outputLabel>
							<p:inputText value="#{irBean.invertedIndexMinTermsOcurrences}"
								size="3"></p:inputText>
							<p:outputLabel>Documentos a procesar:</p:outputLabel>
							<p:inputText value="#{irBean.documentsAmount}" size="5"></p:inputText>
						</p:panelGrid>
						<p:commandButton value="Generar"
							actionListener="#{irBean.buildInvertedIndex}">
						</p:commandButton>
						<p:commandButton id="view1Btn" value="Ver" rendered="false"
							actionListener="#{irBean.queryInvertedIndex}"
							oncomplete="dlg2.show();" update="modalDialog">
						</p:commandButton>

					</p:panelGrid>
					<p:panelGrid columns="1" style="width: 200px; height:150px">
						<f:facet name="header"> Indice Invertido Reducido Zipf</f:facet>
						<p:panelGrid columns="2">
							<p:outputLabel>Zipf CutOn:</p:outputLabel>
							<p:inputText value="#{irBean.zipfCutOn}" size="5"></p:inputText>
							<p:outputLabel>Zipf CutOff:</p:outputLabel>
							<p:inputText value="#{irBean.zipfCutOff}" size="5"></p:inputText>
							<p:outputLabel>Cantidad Minima de Ocurrencias:</p:outputLabel>
							<p:inputText value="#{irBean.zipfMinTermsOcurrences}" size="5"></p:inputText>
						</p:panelGrid>
						<p:commandButton value="Generar"
							actionListener="#{irBean.buildInvertedIndexZipf}">
						</p:commandButton>
						<p:commandButton value="Generar Relevancia"
							actionListener="#{irBean.buildInvertedIndexZipfImproved}">
						</p:commandButton>

					</p:panelGrid>
					<p:panel header="Construccion de Matrices">
						<p:panelGrid columns="1" style="width: 200px; height:75px">
							<f:facet name="header"> Matrix Termino - Termino</f:facet>
							<p:panelGrid columns="2">

							</p:panelGrid>
							<p:commandButton value="Generar"
								actionListener="#{irBean.buildTermTermMatrix}">
							</p:commandButton>
						</p:panelGrid>
						<p:panelGrid columns="1" style="width: 200px; height:75px">
							<f:facet name="header"> Matrix Mutual Information PPMI</f:facet>
							<p:panelGrid columns="2">

							</p:panelGrid>
							<p:commandButton value="Generar"
								actionListener="#{irBean.buildPPMIMatrix}">
							</p:commandButton>

						</p:panelGrid>
					</p:panel>
					<p:panelGrid columns="1" style="width: 200px; height:150px">
						<f:facet name="header">Reduccion de Dimensionalidad</f:facet>
						<p:panelGrid columns="2">
							<p:outputLabel>Numero de Dimensiones:</p:outputLabel>
							<p:inputText value="#{irBean.newDimension}" size="3"></p:inputText>
							<p:outputLabel>Almacenar como Texto Plano:</p:outputLabel>
							<p:selectBooleanCheckbox value="#{irBean.saveReadable}"></p:selectBooleanCheckbox>
							<p:outputLabel>Cantidad de registros a guardar:</p:outputLabel>
							<p:inputText value="#{irBean.readableRowsAmount}" size="3"></p:inputText>
						</p:panelGrid>
						<p:commandButton value="Generar"
							actionListener="#{irBean.buildReducedMatrix}">
						</p:commandButton>

					</p:panelGrid>
					<p:panel>
						<p:panelGrid columns="2" style="width: 200px; height:150px">
							<f:facet name="header">Generacion de Conjuntos Difusos</f:facet>
							<p:outputLabel value="Utilizar Matriz Reducida"></p:outputLabel>
							<p:selectBooleanCheckbox value="#{cmean.reducedMatrix}"></p:selectBooleanCheckbox>
							<p:outputLabel value="Cantidad de Centroides"></p:outputLabel>
							<p:inputText value="#{cmean.centroidsAmount}"></p:inputText>
							<p:outputLabel value="Valor de Fuzzyficacion"></p:outputLabel>
							<p:inputText value="#{cmean.fuzzyValue}"></p:inputText>
							<p:outputLabel value="Valor de Parada"></p:outputLabel>
							<p:inputText value="#{cmean.stopValue}"></p:inputText>
							<p:outputLabel value="Iteraciones"></p:outputLabel>
							<p:inputText value="#{cmean.iterationAmount}"></p:inputText>

						</p:panelGrid>
						<p:commandButton value="Clusterizar"
							actionListener="#{cmean.generate}"></p:commandButton>
						<p:separator></p:separator>

					</p:panel>


					<p:panelGrid columns="1" style="width: 200px; height:150px">
						<f:facet name="header">Indice de Pertenencia</f:facet>
						<div>
							<p:commandButton value="Generar"
								actionListener="#{cmean.generateMembershipIndex}">
							</p:commandButton>

							<p:commandButton value="Categorizar Archivo"
								actionListener="#{cmean.classifyDocumentsInFile}"></p:commandButton>
						</div>
					</p:panelGrid>
					<p:commandButton value="Descargar Indice Invertido" ajax="false"
						onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadInvertedIndex}" />
					</p:commandButton>
					<p:commandButton value="Descargar Indice Reducido" ajax="false"
						onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadInvertedIndexZipf}" />
					</p:commandButton>
					<p:commandButton value="Descargar PMI" ajax="false"
						onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadPMI}" />
					</p:commandButton>
					<p:commandButton value="Descargar Matrix Reducida" ajax="false"
						onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadReduced}" />
					</p:commandButton>
					<p:panelGrid columns="1">
					<p:commandButton value="Descargar Matrix Pertenencia" ajax="false"
						onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadMembershipMatrix}" />
					</p:commandButton>
					<p:commandButton value="Descargar Centroides" ajax="false"
						onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadCentroids}" />
					</p:commandButton>
					
					</p:panelGrid>
					<p:panelGrid columns="1">
					<p:commandButton value="Descargar Indice de Pertenencia"
						ajax="false" onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadMembershipIndex}" />
					</p:commandButton>
					<p:commandButton value="Descargar Archivo clusterizado"
						ajax="false" onclick="PrimeFaces.monitorDownload(start, stop)">
						<p:fileDownload value="#{irBean.downloadDocumentCluster}" />
					</p:commandButton>
					</p:panelGrid>
				</p:panelGrid>
			</p:panel>
			<p:panel>
			</p:panel>
			<p:dialog id="modalDialog" header="Información del Archivo"
				widgetVar="dlg2" modal="true" closeOnEscape="false"
				appendToBody="true" width="1200px" height="600px">
				<p:outputLabel value="#{irBean.documentData}"
					styleClass="documentview" escape="false"></p:outputLabel>
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>